var express = require('express');
var router = express.Router();
const {MessageModel,UserModel,DoctorModel,InqueryModel,PermanModel}=require('../../models/db')

// 获取医生列表
router.get('/getdoctor',async(req,res)=>{
    const result=await DoctorModel.find()
    res.send({code:200,data:result})
})
router.get('/doctors',async (req,res)=>{
    const id  = req.query.id
    const result = await DoctorModel.find({_id:id})
  
    res.send({
        code:200,
        data:result
    })
})

router.get('/perman',async (req,res)=>{
    const result = await PermanModel.find()
    res.send({
        code:200,
        data:result
    })
})
router.post('/inquery',async (req,res)=>{
   const {doctorId,userId,descript,price,imgList,InqueryModel}= req.body
    await InqueryModel.create({doctorId,userId,descript,price,imgList})
   res.send({
       code:200,
       msg:'success'
   })
})
module.exports = router;
